package model;

import java.util.ArrayList;
import java.util.List;

import unit.Player;
import unit.Unit;

import client.ClientPlayer;
import control.Tick;

public class World implements Tick {
	private List<Map> mapList;

	public World(){
		mapList = new ArrayList<Map>();
		Map map = new Map(new MapReader("src/map").getTiles());
		mapList.add(map);
	}
	
	public void tick() {
		for(Map map: mapList) {
			map.tick();
		}
		
	}

	public void addUnit(Unit player) {
		mapList.get(0).addUnit(player);	
	}
	
	public Map getMap(){
		return mapList.get(0);
	}
	
	public Unit getUnitByID(int id){
		for(Map map:mapList){
			if(map.hasUnitByID(id)){
				return map.getUnitByID(id);
			}
		}
		System.out.println("Unit does not exist //World");
		return null;
	}
}
